package site.luojie.framework.pojo;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * @Description: 请求Handler封装对象
 * @Author jie.luo
 * @Create: 2020-05-16 22:53
 **/
public class Handler {

    /**
     * Handler对象
     */
    private Object controller;
    /**
     * Handler对应的方法
     */
    private Method method;
    /**
     * Handler对应的映射URL
     */
    private Pattern pattern;
    /**
     * Handler的参数信息，<参数名,参数的下标>,下标从0开始
     */
    private Map<String, Integer> handlerParameters;
    /**
     * 有权限访问的用户
     */
    private List<String> securityUsers = new ArrayList<>();

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.handlerParameters = new HashMap<>();
    }

    public List<String> getSecurityUsers() {
        return securityUsers;
    }

    public void setSecurityUsers(List<String> securityUsers) {
        this.securityUsers = securityUsers;
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getHandlerParameters() {
        return handlerParameters;
    }

    public void setHandlerParameters(Map<String, Integer> handlerParameters) {
        this.handlerParameters = handlerParameters;
    }
}
